import { cached } from '@/utils'
import { getEnumDict, ENUM_MAP } from './enumDict'

const tags = {
  1: 'success',
  2: 'danger'
}

export const inOutTypes = {
  IN: '1',
  OUT: '2'
}

export async function getChangeTypes() {
  const { data } = await getEnumDict(ENUM_MAP.changeType)
  return data
}

export function getChangeTypeTag(val) {
  return cached((val) => tags[val])
}
